function [Q LL] = mog_E_step(X, mog)
    % Function that does the E-step of the EM-algorithm.

    Totals = zeros(size(X(:, 1:2), 1), 1);
    LL = 0;

    for i = 1:size(mog, 2)
        Q{i} = mvnpdf(X(:, 1:2), mog{i}.MU, mog{i}.SIGMA);
        Totals = Totals + Q{i};
        LL = LL + log(sum(Q{i}));
    end

    for i = 1:size(mog, 2)
        Q{i} = Q{i} ./ Totals;
    end
 

